//
//  FMCollectTableViewCell.m
//  PsychologyFM
//
//  Created by zhang on 16/1/23.
//  Copyright © 2016年 ZhangLuDu. All rights reserved.
//

#import <UIImageView+WebCache.h>
#import "FMCollectTableViewCell.h"

@implementation FMCollectTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview];
    }
    return self;
}
- (void)addSubview{

    self.coverImage = [[UIImageView alloc]initWithFrame:CGRectMake(kMartin10, kMartin10, kScreenWidth/6, kScreenWidth/6)];
//    self.coverImage.backgroundColor = FMGreen;
    [self.contentView addSubview:_coverImage];
    
    self.titleLable = [[UILabel alloc]initWithFrame:CGRectMake(self.coverImage.right + kMartin15, self.coverImage.top, kScreenWidth - self.coverImage.right - kMartin20, (kScreenWidth/6 - kMartin10)/ 3)];
    self.titleLable.font = [UIFont systemFontOfSize:14];
//    self.titleLable.backgroundColor = FMGreen;
    [self.contentView addSubview:_titleLable];
    
    self.speakLable = [[UILabel alloc]initWithFrame:CGRectMake(self.titleLable.left, self.titleLable.bottom + kMartin5, self.titleLable.width, (kScreenWidth/6 - kMartin10)/ 3)];
//    self.speakLable.backgroundColor = FMGreen;
    self.speakLable.font = [UIFont systemFontOfSize:14];

    [self.contentView addSubview:_speakLable];
    
    self.favnumLable = [[UILabel alloc]initWithFrame:CGRectMake(self.speakLable.left, self.speakLable.bottom + kMartin5, self.speakLable.width, (kScreenWidth/6 - kMartin10)/ 3 )];
    self.favnumLable.font = [UIFont systemFontOfSize:14];

//    self.favnumLable.backgroundColor = FMGreen;
    [self.contentView addSubview:_favnumLable];
    
    

}

- (void)setModel:(FMCollectionModel *)model{

    _model = model;
    [self.coverImage sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:nil];
    
    self.titleLable.text = model.title;
    self.speakLable.text = [NSString stringWithFormat:@"主播 %@",model.speak];
    self.favnumLable.text = [NSString stringWithFormat:@"收藏 %@",model.favnum];

}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
